<?php

namespace app\admin\model;

use think\Model;
use think\model\concern\SoftDelete;
use app\system\model\Dept;
use app\system\model\Role;
use app\system\model\Post;

/**
 * 管理员模型
 */
class Admin extends Model
{
    /**
     * 启用软删除
     */
    use SoftDelete;
    protected $deleteTime = 'delete_time';
    protected $defaultSoftDelete = 0;

    /**
     * 数据表名称
     * @var string
     */
    protected $name = 'admin';

    /**
     * 关联部门
     */
    public function dept()
    {
        return $this->belongsTo(Dept::class, 'dept_id');
    }

    /**
     * 关联角色
     */
    public function role()
    {
        return $this->belongsTo(Role::class, 'role_id');
    }

    /**
     * 关联岗位
     */
    public function job()
    {
        return $this->belongsTo(Post::class, 'job_id');
    }
}
